/**
 * Copyright (c) 2024-2025 National Fundamental Software of China Co., Ltd.
 *
 * You should have find a copy of NFSChina License. If not, please contact us
 * by email <os_support@nfschina>
 *
**/

/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2014 Marco Martin <mart@kde.org>
SPDX-FileCopyrightText: 2019 Kevin Ottens <kevin.ottens@enioka.com>
SPDX-FileCopyrightText: 2020 David Redondo <kde@david-redondo.de>

SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once

#include <KConfigPropertyMap>
#include <KPackage/Package>
#include <KQuickAddons/ManagedConfigModule>

#include "wallpaper_integration.h"

class WallpaperKcm : public KQuickAddons::ManagedConfigModule
{
    Q_OBJECT
    Q_PROPERTY(QUrl wallpaperConfigFile READ wallpaperConfigFile NOTIFY currentWallpaperChanged)
    Q_PROPERTY(QUrl wallpaperMainFile READ wallpaperMainFile NOTIFY currentWallpaperChanged)
    Q_PROPERTY(QUrl wallpaperThumbnailsFile READ wallpaperThumbnailsFile NOTIFY currentWallpaperChanged)
    Q_PROPERTY(KCMWallpaper::WallpaperIntegration *wallpaperIntegration READ wallpaperIntegration NOTIFY currentWallpaperChanged)
    Q_PROPERTY(QString currentWallpaper READ currentWallpaper NOTIFY currentWallpaperChanged)

public:
    explicit WallpaperKcm(QObject *parent, const KPluginMetaData &data, const QVariantList &args);

    QUrl wallpaperConfigFile() const;
    QUrl wallpaperMainFile() const;
    QUrl wallpaperThumbnailsFile() const;
    KCMWallpaper::WallpaperIntegration *wallpaperIntegration() const;
    QString currentWallpaper() const;
    
public Q_SLOTS:   
     void setWallpaper(const QString& path);

Q_SIGNALS:
    void currentWallpaperChanged();   

private:
    void loadWallpaperConfig();

    KCMWallpaper::WallpaperIntegration *m_wallpaperIntegration = nullptr;
    QUrl m_wallpaperConfigFile;
    QUrl m_wallpaperMainFile;
    QUrl m_wallpaperThumbnailsFile;
};


